<template>
    <!-- 公司组织（项目）树搜索 -->
    <tree-search
        v-bind="$attrs"
        v-on="$listeners"
        isAll
        ref="treeSearch"
        loadList="getTree"
        :query="query"
        emptyDescription="暂无组织机构信息"
        :replaceFields="{ children: 'children', title: 'name', key: 'id' }"
        :api="apiTree"
        :selectedKeys.sync="selectedKeys"
        :selectOptions.sync="selectOptions"
    ></tree-search>
</template>

<script>
import TreeSearch from '@/components/businessComponents/TreeSearch' // 树
import { experimentTable } from '@/api/quality/quality' // api
export default {
    name:'TreeProject',
    components: {
        TreeSearch,
    },
    props:{
        // 请求参数
        query: {
            type: [Object],
            default() {
                return null
            }
        },
    },
    computed: {
        // 树节点api
        apiTree() {
            return experimentTable
        },
    },
    data() {
        return {
            selectedKeys: {},
            selectOptions: {},
        }
    },
    methods: {
        // 渲染列表
        getList() {
            return this.$refs.treeSearch.getList()
        },
    },
    watch: {
        selectedKeys(e) {
            this.$emit('update:selectedKeys', e)
        },
        selectOptions(e) {
            this.$emit('update:selectOptions', e)
        },
    },
}
</script>
